<?php
include 'inc/header.php';

title('常用内置方法');

comment('提前退出程序');

function printNum($i)
{
	if ($i !== 10) {
		echo $i, " \n";
	} else {
		exit();
	}
}

if (isset($_GET['exit'])) {
	$n = 1;

	while ($n < 20) {
		printNum($n);
		$n++;
	}
}

comment('判断变量为空');
class MyObj
{
}
$myObj = new MyObj;
$arr = array('', 0, 0.0, false, null, array(), $myObj);
foreach ($arr as $val) {
	clog("$val is empty? " . (empty($val) ? 'yes' : 'no'));
}


include 'inc/footer.php';